﻿@model SkResult<string>
<div class="ui-box-simple">
    <div class="ui-box-simple-header">
        <h3>
            设置新密码</h3>
        <p>
            小米帐户能使用小米手机、米聊、MIUI和小米的其他服务。如果您已拥有小米帐户，则可<a class="cor_yellow" href="/">在此登录</a></p>
    </div>
    <div class="ui-box-simple-container">
        <div class="passport-forgotpassword">
        @if (Model.Status)
        {
            <form id="form-reset-password-by-email" class="form-horizontal" method="post" action="/home/resetpasswordbyemail/@Model.Message">
                <div class="control-group">
                    <label class="control-label" for="email">
                        邮 箱
                    </label>
                    <div class="controls">@Model.Data
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="password">
                        新密码</label>
                    <div class="controls">
                        <input type="password" id="password" name="password" maxlength="12" placeholder="请输入您的新密码" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="confirmPassword">
                        确认新密码</label>
                    <div class="controls">
                        <input type="password" id="confirmPassword" name="confirmPassword" maxlength="12"
                               placeholder="请再次输入您的新密码" />
                    </div>
                </div>
                <div class="form-actions border-none background-none">
                    <span class="ui-button ui-button-ok clearfix"><span class="ui-button-left">&nbsp;</span>
                        <button type="submit" class="ui-button-text">
                            设 置 新 密 码</button><span class="ui-button-right">&nbsp;</span></span>
                </div>
            </form>
        }else
        {
            <div>@Model.Message</div>
        }
        </div>
    </div>
    <div class="ui-box-simple-footer">
        <p class="tc">
            您还可以拨打帮助热线：021-61065336，以获取人工帮助
        </p>
    </div>
</div>
@section css{
    @Url.Sk().StaticCss("sk.passport")
    @Url.Sk().StaticCss("jquery.fancybox")
}
@section js{
    @Url.Sk().StaticJs("jquery.validate.min")
    @Url.Sk().StaticJs("jquery.validate.extend")
    @Url.Sk().StaticJs("jquery.fancybox.pack")
    <script type="text/javascript">

        $(function () {
            $('[data-rel="popover"]').popover();
            //$('.typeahead').typeahead({ source: function () { return ["ddd", "daa"] } });

            $('#form-reset-password-by-email').validate({
                rules: { 'password': { required: true, password: true }, 'confirmPassword': { required: true, password: true, equalTo: "#password"} },
                messages: { 'password': { required: '请输入新密码！', password: '请输入符合格式的密码！' }, 'confirmPassword': { required: '请再次输入新密码！', password: '请输入符合格式的密码！', equalTo: "两次输入密码不一致！"} },
                submitHandler: function (form) {
                    var param = $(form).serialize();
                    $.postJSON(form.action, param, function (result) {
                        if (result.Status == true) {
                            //$.fancybox.open({ href: '#myModal', type: 'inline', modal: true, padding: 0 });
                        }
                        else {
                            $("#register-message").html(result.Message);
                        }
                    });
                    return false;
                }
            });
        });
        
    </script>
}
